﻿
// 2023/2/28: 首个版本
// 2023/7/6: 使用resizeYuv420Quarter
// 2025/7/16: 移除SPADAS_DEPRECATED_HIDE
// 2025/11/4: 继承Object。析构时调用close

#ifndef SWSCALE_CPU_H_
#define SWSCALE_CPU_H_

#include "spadas.h"
#include "NextCompatibleImage.h"

namespace videonext
{
	using namespace spadas;

	class SWScaleConverterBGRYUV : public Object<class SWScaleConverterBGRYUVVars>
	{
	public:
		SWScaleConverterBGRYUV();
		Bool open(Size2D targetSize);
		void close();
		// input: ImagePointerColor or IplImageColor, output: renew AVFrameYUV420P
		Bool convert(CompatibleImage src, CompatibleImage& dst);
	};

	class SWScaleConverterYUVBGR : public Object<class SWScaleConverterYUVBGRVars>
	{
	public:
		SWScaleConverterYUVBGR();
		Bool open(Size2D targetSize);
		void close();
		// input: AVFrameYUV420P, output: renew ImagePointerColor
		Bool convert(CompatibleImage src, CompatibleImage& dst);
	};

	class SWScaleResizerYUV : public Object<class SWScaleResizerYUVVars>
	{
	public:
		SWScaleResizerYUV();
		Bool open(Size2D srcSize, Size2D dstSize);
		void close();
		// input: AVFrameYUV420P, output: renew AVFrameYUV420P
		Bool resize(CompatibleImage src, CompatibleImage& dst, Bool canRefer);
	};
}

#endif
